<%--
  Created by IntelliJ IDEA.
  User: 28101
  Date: 2021/9/23
  Time: 23:57
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="jstl" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link href="/css/bootstrap-theme.css" rel="stylesheet">
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <script src="../js/jquery-3.3.1.min.js"></script>
    <title>历史订单</title>
    <style>

        .tabdiv{
            width: 70%;
            margin-left: 200px;
            margin-top: 50px;
        }

    </style>
</head>
<body>

    <div style="height: 50px;background-color: rgba(250, 235, 215, 0.57)">
        <table style="position:relative; left:260px; top:15px;margin-left: 500px">
            <tr>
                <td width="60px" align="center" class="loginbtn">主页</td>
                <td width="200px"></td>
                <td width="200px" align="center" class="shopcartbtn">购物车</td>

                <td width="200px" align="center" class="mycartbtn">我的订单</td>

                <jstl:if test="${user != null}">
                    <div hidden="hidden">${user.uid }</div>
                    <td width="300px" align="center" hidden="hidden">
                            ${user.uid }
                    </td>
                    <td>
                            ${user.name }
                    </td>
                </jstl:if>

                <jstl:if test="${user == null}">
                    <td class="login">
                        登录
                    </td>
                </jstl:if>
            </tr>
        </table>
    </div>

    <div style="margin-top: 10px;padding: 20px" class="tabdiv">
        <table class="table table-striped table-hover table-bordered">
            <tr>
                <th>商品</th>
                <th>商品版本</th>
                <th>商品颜色</th>
                <th>购买数量</th>
                <th>购买总价</th>
                <th>购买时间</th>
            </tr>

            <jstl:if test="${hisList != null}">

                <jstl:forEach items="${hisList }" var="list">
                    <tr>

                        <td>${list.commodity.commodityName}</td>
                        <td>
                            ${list.commodityVersion.versionname }
                        </td>
                        <td>
                            ${list.commodityColor.colorname }
                        </td>
                        <td>
                            ${list.buycount }
                        </td>
                        <td>
                            ${list.commodityVersion.cprice * list.buycount }
                        </td>
                        <td>
                            ${list.buytime }
                        </td>
                    </tr>
                </jstl:forEach>
            </jstl:if>

        </table>

    </div>

    <script src="/js/bootstrap.min.js"></script>

    <script>

        $(".login").click(function () {
            window.location.href = "/UserServlet?method=logout";
        });

        $(".loginbtn").click(function () {
            window.location.href = "/index.jsp";
        })

        $(".shopcartbtn").click(function () {
            window.location.href = "/jsp/shoppingCustom.jsp";
        })

        $(".mycartbtn").click(function () {
            window.location.href = "/HisShoppingCustomServlet?method=getUserHisShoppingCustom";
        })
    </script>
</body>
</html>
